from django.db import models
from myutils.base_model import BaseModel

class Role(BaseModel):
    name=models.CharField(max_length=32)

    class Meta:
        db_table='role'

    def __str__(self):
        return self.name


class User(BaseModel):
    username=models.CharField(max_length=32)
    password=models.CharField(max_length=255)
    phone=models.CharField(max_length=11,null=True,blank=True)
    email=models.EmailField(max_length=30,null=True,blank=True)
    status=models.BooleanField(default=False)
    role=models.ForeignKey('Role',on_delete=models.CASCADE)

    class Meta:
        db_table='user'

    def __str__(self):
        return self.username
